//
//  TLImageViewController.swift
//  TLiOS26LiquidGlassDemo
//
//  Created by jiayin on 2025/8/4.
//

import UIKit

/**
 Symbol Animations 新增动画效果drawOn与drawOff。
 */
class TLImageViewController: UIViewController {
    lazy var imageView: UIImageView = {
        let config = UIImage.SymbolConfiguration(pointSize: 100, weight: .thin, scale: .large)
        let image = UIImage(systemName: "26.square", withConfiguration: config)
        let imageView = UIImageView(image: image)
        imageView.frame = CGRect(x: 0, y: 0, width: 300, height: 300)
        imageView.contentMode = .scaleAspectFit
        imageView.center = view.center
        return imageView
    }()

    override func viewDidLoad() {
        super.viewDidLoad()

        view.addSubview(imageView)
    }

    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        imageView.addSymbolEffect(.drawOff, options: .speed(0.1)) // drawOff动画效果

        DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
            self.imageView.addSymbolEffect(.drawOn, options: .speed(0.1)) // drawOn动画效果
        }
    }
}

